package com.cloudsigns.factorymanager2.project.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.BaseActivity;
import com.cloudsigns.factorymanager2.R;

public class BatchInstallationOrderDetailActivity1 extends BaseActivity{
    private ImageView img_back;
    private TextView tv_title;
    private ImageView img_project_select,img_information_select;
    private ListView lv;
    private LinearLayout ll_engineering_info_content;
    private TextView tv_project_name, tv_engineering_name,edt_dispath_order_person_colon,edt_dispath_order_time_colon,edt_receive_people_colon,edt_reception_time_colon;

    @Override
    protected void onBaseCreate(Bundle savedInstanceState) {
        setContentView(R.layout.layout_batch_installation_order_detail1);
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        img_back = findViewById(R.id.img_back);
        tv_title = findViewById(R.id.tv_title);
        tv_project_name=findViewById(R.id.tv_project_name);
        tv_engineering_name=findViewById(R.id.tv_engineering_name);
        edt_dispath_order_person_colon=findViewById(R.id.edt_dispath_order_person_colon);
        edt_dispath_order_time_colon=findViewById(R.id.edt_dispath_order_time_colon);
        edt_receive_people_colon=findViewById(R.id.edt_receive_people_colon);
        edt_reception_time_colon=findViewById(R.id.edt_reception_time_colon);
        img_project_select=findViewById(R.id.img_project_select);
        img_information_select=findViewById(R.id.img_information_select);
        lv=findViewById(R.id.lv);
        ll_engineering_info_content=findViewById(R.id.ll_engineering_info_content);
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        tv_title.setText(getResources().getText(R.string.batch_installation_order));
        img_project_select.setBackgroundResource(R.mipmap.arrow_down_icon);
        img_information_select.setBackgroundResource(R.mipmap.arrow_down_icon);
    }

    // 项目名称/工程名称 收放
    private void showEngineeringInfoDialog() {
        if (ll_engineering_info_content.getVisibility() == View.VISIBLE) {
            ll_engineering_info_content.setVisibility(View.GONE);
            img_project_select.setBackgroundResource(R.mipmap.arrow_down_icon);
        } else {
            ll_engineering_info_content.setVisibility(View.VISIBLE);
            img_project_select.setBackgroundResource(R.mipmap.arrow_top);
        }
    }

    // 工程信息 收放
    private void showEngineeringInfoSelect() {
        if (lv.getVisibility() == View.VISIBLE) {
            lv.setVisibility(View.GONE);
            img_information_select.setBackgroundResource(R.mipmap.arrow_down_icon);
        } else {
            lv.setVisibility(View.VISIBLE);
            img_information_select.setBackgroundResource(R.mipmap.arrow_top);
        }
    }

    @Override
    public void setListener() {
        img_back.setOnClickListener(this);
        img_project_select.setOnClickListener(this);
        img_information_select.setOnClickListener(this);
    }

    @Override
    public void widgetClick(View v) {
        switch (v.getId()){
            case R.id.img_back:
                finish();
                break;
                // 项目名称/工程名称 收放
            case R.id.img_project_select:
                showEngineeringInfoDialog();
                break;
                // 工程信息 收放
            case R.id.img_information_select:
                showEngineeringInfoSelect();
                break;
        }
    }
}
